<template>
	<view class="container">
		<view class="recordList">
			
			<view class="recordItem" v-for="item in recordList" :key="item.id">
				<view class="title">{{item.num}}</view>
				<view class="remarks">{{item.type_label}}</view>
				<view class="time">{{item.create_time}}</view>
			</view>
			
		</view>
		<u-loadmore :status="status" />
	</view>
</template>

<script>
	import {
		stockRecordList
	} from "@/common/api.js";
	export default {
		components: {},
		data() {
			return {
				page: 1,
				status: 'loadmore',
				recordList: []
			};
		},
		onLoad() {
			this.selectOrder()
		},
		onReachBottom() {
			this.selectOrder()
		},
		methods: {
			selectOrder() {
				stockRecordList(this, {
					page: this.page
				}, (res) => {
					this.$set(this, 'recordList', [...this.recordList, ...res])
					this.page++
					this.status = 'loadmore'
					if (res.length === 0) {
						this.status = 'nomore'
					}
				})
			}
		}
	};
</script>
<style lang="scss">
	page {
		font-family: PingFang SC;
		background-color: #F6F6F6;
		height: 100%;
	}

	.recordItem {
		margin: 15rpx 15rpx 25rpx 15rpx;
		border-radius: 15rpx;
		background-color: #FFFFFF;
		padding: 15rpx;
		position: relative;

		.title {
			color: #333333;
			font-size: 18px;
			height: 80rpx;
			line-height: 80rpx;
			position: absolute;
			right: 20rpx;
			top: 15rpx;
			font-weight: bold;
		}

		.remarks {
			font-size: 16px;
			color: #333;
			height: 80rpx;
			line-height: 80rpx;
		}

		.time {
			font-size: 12px;
			color: #999999;
			height: 36rpx;
			line-height: 36rpx;
		}
	}
</style>